package com.rookieci.totp.activity;

import android.app.Activity;
import android.content.Intent;
import android.graphics.Bitmap;
import android.os.Bundle;
import android.widget.ImageView;

import com.rookieci.totp.R;

import io.github.xudaojie.qrcodelib.common.QrUtils;

/**
 * Created by 磁磁帅 on 2025/8/10 0010.
 * 功能：
 */
public class QrCodeImageActivity extends Activity {
    private String codeTxt;
    private ImageView image;

    public static void open(Activity activity, String text) {
        Intent intent = new Intent(activity, QrCodeImageActivity.class);
        intent.putExtra("text", text);
        activity.startActivity(intent);
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_qrcode_image);
        Intent intent = getIntent();
        codeTxt = intent.getStringExtra("text");
        image = findViewById(R.id.image);

        Bitmap bitmap = QrUtils.generateQRCode(codeTxt, 800, 800);
        image.setImageBitmap(bitmap);
    }
}
